/**
 * Copyright (c) 快宝网络 kuaidihelp.com Co., Ltd. All Rights Reserved 禁止外泄以及用于其它的商业用途
 */

import { getApplicantUpdate } from '@/services/finance_receipt';
import { ModalForm, ProFormTextArea } from '@ant-design/pro-form';
import { message } from 'antd';
import React from 'react';

const RejectReason: React.FC<{ id: string; status: number; callback: () => void }> = (props) => {
  return (
    <ModalForm
      title='确定拒绝开票吗？'
      trigger={<a>拒绝</a>}
      width={400}
      modalProps={{
        destroyOnClose: true,
        footer: null,
        centered: true,
      }}
      onFinish={async ({ admin_commnet }) => {
        if (!admin_commnet) {
          message.error('请输出拒绝原因');
          return false;
        }
        const { code } = await getApplicantUpdate({ ...props, admin_commnet });
        return code == 0;
      }}
    >
      <ProFormTextArea name='admin_commnet' placeholder={'请数据拒绝原因'} />
    </ModalForm>
  );
};

export default RejectReason;
